<!--学生评价表-->
<div class="OutDiv">
  <!--主页面-->
  <div class="mainPage" [hidden]="mainStatus !== 1">
    <div class="exciseTableDiv">
      <div class="aRow tableTop">
        <button nz-button nzType="primary" (click)="clickAdd()"><i nz-icon nzType="plus" nzTheme="outline"></i>新增</button>
        <button nz-button nzType="default"
                nz-popconfirm
                nzOkType="danger"
                nzTitle="确定删除所选记录吗?"
                (nzOnCancel)="moveCloseFn()"
                (nzOnConfirm)="deleteAll()"
                nzPlacement="top"
                [disabled]="canDelete"
        >
          <i nz-icon nzType="delete" nzTheme="outline"></i>删除
        </button>
        <label style="float: right;">
          <span>评价表名称：</span>
          <input nz-input [(ngModel)]="formname" placeholder="请输入"/>
          <button nz-button style="margin-right:10px;" nzType="primary" (click)="clickSearch()">查询
          </button>
          <button style="margin-right: 0" nz-button nzType="default" (click)="resetSearch()">重置</button>
        </label>
      </div>
      <div class="w100 fl-l">
        <ng-template #totalTemplate let-total>总共 {{ pageInfo.totalRecords ? pageInfo.totalRecords : 0 }}条
        </ng-template>
        <nz-table
          #exciseBankTable
          nzBordered
          [nzData]="allList"
          [nzFrontPagination]="false"
          [nzShowPagination]="true"
          [nzPageIndex]="pageInfo.first"
          [nzTotal]="pageInfo.totalRecords"
          [nzShowTotal]="totalTemplate"
          [nzPageSize]="pageInfo.rows"
          [nzLoadingDelay]="1"
          [nzPageSizeOptions]="[10,20,30,50,100]"
          [nzShowQuickJumper]="true"
          [nzShowSizeChanger]="true"
          (nzPageIndexChange)="searchPageIndex($event)"
          (nzPageSizeChange)="searchPageSize($event)"
          (nzCurrentPageDataChange)="currentPageDataChange($event)"
        >
          <thead>
          <tr>
            <th class="tableCheck"
                nzShowCheckbox
                [(nzChecked)]="isAllCheck"
                [nzIndeterminate]="isIndeterminate"
                (nzCheckedChange)="checkAll($event)"
            ></th>
            <th>评价表名称</th>
            <th>总分（分）</th>
            <th>题目总数</th>
            <th>创建人</th>
            <th>创建日期</th>
            <th style="width:180px;">操作</th>
          </tr>
          </thead>
          <tbody>
          <tr *ngFor="let data of exciseBankTable.data">
            <td
              nzShowCheckbox
              [(nzChecked)]="mapOfCheckedId[data.id]"
              (nzCheckedChange)="refreshStatus()"
            ></td>
            <td>{{ data.name}}</td>
            <td>{{ data.score}}</td>
            <td>{{ data.questionCount}}</td>
            <td>{{ data.createName}}</td>
            <td>{{ data.gmtCreate | date: 'yyyy-MM-dd HH:mm:ss'}}</td>
            <td>
              <span class="operaFont firOpera" (click)="preview(data)">预览</span>
              <span class="operaFont firOpera" (click)="edit(data)">编辑</span>
              <span class="operaFont firOpera" (click)="downLoad(data.id)">下载</span>
              <span class="operaFont operaTao"
                    nz-popconfirm
                    nzOkType="danger"
                    nzTitle="确定删除该记录吗?"
                    (nzOnConfirm)="deleteOne(data.id)"
                    nzPlacement="top"
              >删除</span>
            </td>
          </tr>
          </tbody>
        </nz-table>
      </div>
    </div>
  </div>
  <!--新增页面-->
  <div class="addPage" *ngIf="mainStatus === 2">
    <div style="height: 50px;font-size: 18px;">
      <span>{{paperInfos.id?'编辑':'新增'}}评价表</span>
      <span class="fl-r operaFont" (click)="back()">
        返回上一级<i class="fa fa-reply m-l-sm"></i>
      </span>
    </div>
    <div>
      <div class="left-body">
        <div>
          <span style="color: red;margin-right: 3px">*</span>评价表名称：
          <input nz-input class="text-center tit-input nameivpt" placeholder="请输入" [(ngModel)]="paperInfos.name"/>
        </div>
        <div class="sub-item" *ngFor="let firItem of paperInfos.cateList;let i = index">
          <!--单选题-->
          <div class="w100 fl-l" *ngIf="firItem.cate == '单选题'">
            <div class="top-item">
              <span class="titlexh">{{reCapitalization(i + 1)}}、{{firItem.cate}}</span>
              <span [ngClass]="{'button-blue':firItem.extractType===2}" class="blue-btn-ch m-l-lm" (click)="chooseAuto(i)">随机抽题</span>
              <span [ngClass]="{'button-blue':firItem.extractType===1}" class="blue-btn-ch m-l-lm" (click)="chooseModal(firItem.cate,i)">选择题目</span>
            </div>
<!--            随机抽提-->
            <div class="card-some" [hidden]="firItem.extractType === 1">
              <div class="line-4 w100 pad-item">
                <span>题目分类：</span>
                <nz-tree-select
                  style="width: 400px"
                  [nzNodes]="treeNodes"
                  nzShowSearch
                  nzCheckable
                  nzPlaceHolder="请选择题目分类"
                  [(ngModel)]="firItem.sortList"
                  (ngModelChange)="onChangeQuestions($event,firItem.cate,i)"
                >
                </nz-tree-select>
              </div>
              <div class="bor-white">
                <div class="bc-white" *ngIf="firItem.randomList && firItem.randomList.length > 0">
                  <div nz-row *ngFor="let twoItem of firItem.randomList">
                    <div nz-col nzSpan="24">
                      <div class="pl-sl" nzSpan="24">
                        <div nz-col nzSpan="8">
                          {{twoItem.classifyName}}（{{twoItem.count}}道）
                        </div>
                        <div nz-col nzSpan="8">
                          <span class="ml-r">抽选</span>
                          <nz-input-number [(ngModel)]="twoItem.selectCount" [nzMin]="1" [nzMax]="twoItem.count" [nzStep]="1"
                                           (ngModelChange)="calculation()" style="width: 78px"></nz-input-number>
                          道
                        </div>
                        <div nz-col nzSpan="8">
                          <span class="ml-r">每题</span>
                          <nz-input-number [(ngModel)]="twoItem.score" [nzMin]="1" [nzStep]="1"
                                           (ngModelChange)="scoChange(i)" style="width: 78px"></nz-input-number>
                          分
                        </div>
                      </div>
                    </div>
                  </div>
                </div>
              </div>
            </div>
<!--            选择题目-->
            <div class="card-some" [hidden]="firItem.extractType !== 1" *ngFor="let twoItem of firItem.selectList;let num=index">
              <div class="some-left">
                <div class="tit-item" [innerHTML]="twoItem.content"></div>
                <div class="line-3 letter-item" *ngFor="let itemList of twoItem.selectList;let j=index">
                  <span class="yuan">{{letter[j]}}</span>
                  <span>{{itemList.name}}</span>
                  <span>{{itemList.scoreRatio}}</span>
                </div>
              </div>
              <div class="some-right">
                <div class="w-6 fl-l h100">
            <span class="fen-shu">
              分数
              <nz-input-number style="width: 65px" [nzMin]="1" [nzStep]="1" nzSize="small"
                               [(ngModel)]="twoItem.score"
                               (ngModelChange)="calculation()"></nz-input-number>
              分
            </span>
                </div>
                <div class="w-4 fl-l h100">
                  <button nz-button nzType="default" nz-popconfirm nzOkType="danger" nzTitle="确定删除该题目吗?"
                          nzPlacement="top"
                          (nzOnConfirm)="deleteItem(i,num)">
                    <i class="fa fa-trash-o"></i>删除
                  </button>
                  <button [disabled]="num === 0" nz-button nzType="default" (click)="upDataItem(i,num)"><i
                    class="fa fa-angle-up"></i>上移
                  </button>
                  <button [disabled]="firItem.selectList.length === (num+1)" nz-button nzType="default"
                          (click)="downDataItem(i,num)">
                    <i class="fa fa-angle-down"></i>下移
                  </button>
                </div>
              </div>
            </div>
          </div>
          <!--简答题-->
          <div class="w100 fl-l" *ngIf="firItem.cate == '简答题'">
            <div class="top-item">
              <span class="titlexh">{{reCapitalization(i + 1)}}、{{firItem.cate}}</span>
              <span [ngClass]="{'button-blue':firItem.extractType===2}" class="blue-btn-ch m-l-lm" (click)="chooseAuto(i)">随机抽题</span>
              <span [ngClass]="{'button-blue':firItem.extractType===1}" class="blue-btn-ch m-l-lm" (click)="chooseModal(firItem.cate,i)">选择题目</span>
            </div>
            <div class="card-some" [hidden]="firItem.extractType === 1">
              <div class="line-4 w100 pad-item">
                <span>题目分类：</span>
                <nz-tree-select
                  style="width: 400px"
                  [nzNodes]="treeNodes"
                  nzShowSearch
                  nzCheckable
                  nzPlaceHolder="请选择题目分类"
                  [(ngModel)]="firItem.sortList"
                  (ngModelChange)="onChangeQuestions($event,firItem.cate,i)"
                >
                </nz-tree-select>
              </div>
              <div class="bor-white">
                <div class="bc-white" *ngIf="firItem.randomList && firItem.randomList.length > 0">
                  <div nz-row *ngFor="let twoItem of firItem.randomList">
                    <div nz-col nzSpan="24">
                      <div class="pl-sl" nzSpan="24">
                        <div nz-col nzSpan="8">
                          {{twoItem.classifyName}}（{{twoItem.count}}道）
                        </div>
                        <div nz-col nzSpan="8">
                          <span class="ml-r">抽选</span>
                          <nz-input-number [(ngModel)]="twoItem.selectCount" [nzMin]="1" [nzMax]="twoItem.count" [nzStep]="1"
                                           (ngModelChange)="calculation()" style="width: 78px"></nz-input-number>
                          道
                        </div>
                        <div nz-col nzSpan="8">
                          <!--<span class="ml-r">每题</span>-->
                          <!--<nz-input-number [(ngModel)]="twoItem.score" [nzMin]="1" [nzStep]="1"-->
                                           <!--(ngModelChange)="scoChange(i)" style="width: 78px"></nz-input-number>-->
                          <!--分-->
                        </div>
                      </div>
                    </div>
                  </div>
                </div>
              </div>
            </div>
            <div class="card-some" [hidden]="firItem.extractType !== 1" *ngFor="let twoItem of firItem.selectList;let num=index">
              <div class="some-left">
                <div class="tit-item" [innerHTML]="twoItem.content"></div>
              </div>
              <div class="some-right">
                <!--<div class="w-6 fl-l h100">-->
                  <!--<span class="fen-shu">-->
                    <!--分数-->
                    <!--<nz-input-number style="width: 65px" [nzMin]="1" [nzStep]="1" nzSize="small"-->
                                     <!--[(ngModel)]="twoItem.score"-->
                                     <!--(ngModelChange)="calculation()"></nz-input-number>-->
                    <!--分-->
                  <!--</span>-->
                <!--</div>-->
                <div class="w-4 fl-r h100">
                  <button nz-button nzType="default" nz-popconfirm nzOkType="danger" nzTitle="确定删除该题目吗?"
                          nzPlacement="top"
                          (nzOnConfirm)="deleteItem(i,num)">
                    <i class="fa fa-trash-o"></i>删除
                  </button>
                  <button [disabled]="num === 0" nz-button nzType="default" (click)="upDataItem(i,num)"><i
                    class="fa fa-angle-up"></i>上移
                  </button>
                  <button [disabled]="firItem.selectList.length === (num+1)" nz-button nzType="default"
                          (click)="downDataItem(i,num)">
                    <i class="fa fa-angle-down"></i>下移
                  </button>
                </div>
              </div>
            </div>
          </div>
        </div>
        <div class="hover-div">
          <div class="hov-cen" (mouseover)="isHoverShow = true" (mouseleave)="isHoverShow = false">
            <div class="h100 w100" [hidden]="isHoverShow">
              <div class="run-i just-center">
                <i class="fa fa-plus"></i>
              </div>
              <span>创建新的大题</span>
            </div>
            <div class="h100 w100" style="line-height: 90px" [hidden]="!isHoverShow">
              <button nz-button nzType="default" (click)="addItem('单选题')">单选题</button>
              <button nz-button nzType="default" style="margin-left: 20px" (click)="addItem('简答题')">简答题</button>
            </div>
          </div>
        </div>
      </div>
      <div class="right-body">
        <div class="kuai-right-score" *ngFor="let item of paperInfos.cateList;let i=index">
          <div class="w100 pad-lr spance line-3">
            <span>{{reCapitalization(i + 1)}}、 {{item.cate}}</span>
          </div>
          <div class="line-3 w100 pad-lr">
            <span>共</span>
            <span class="total-score">{{item.questionCount?item.questionCount:0}}</span>
            <span>题</span>
            <span [hidden]="item.cate == '简答题'">，共</span>
            <span class="total-score" [hidden]="item.cate == '简答题'">{{item.sumscore?item.sumscore:0}}</span>
            <span [hidden]="item.cate == '简答题'">分</span>
          </div>
          <div class="line-4 w100 pad-lr" [hidden]="item.cate == '简答题'">
            <span>每题</span>
            <nz-input-number style="width: 65px;margin: 0 12px;" [nzMin]="1" [nzStep]="1" nzSize="small"
                             [(ngModel)]="item.score"
                             (ngModelChange)="setAverage(i)"></nz-input-number>
            <span>分</span>
          </div>
          <div class="line-4 w100 cursor">
            <div nz-col nzSpan="8" class="kuai-bt" nz-popconfirm nzOkType="danger" nzTitle="确定删除该题目类型吗?" nzPlacement="top"
                 (nzOnConfirm)="deleteItemType(i)"><i class="fa fa-trash-o" title="删除整类"></i></div>
            <div nz-col nzSpan="8" class="kuai-bt i-bor" (click)="upData(i)"><i class="fa fa-angle-up" title="上移"></i>
            </div>
            <div nz-col nzSpan="8" class="kuai-bt i-bor" (click)="downData(i)"><i class="fa fa-angle-down"
                                                                                  title="下移"></i></div>
          </div>
        </div>
        <div class="total-all-bt" [hidden]="!paperInfos.cateList">
          <div class="w100 line-3">
            <span>总题数：{{paperInfos.questionCount ? paperInfos.questionCount : 0}}题</span>
          </div>
          <div class="line-3">
            <span>当前总分：{{paperInfos.score ? paperInfos.score : 0}}分</span>
          </div>
        </div>
        <div class="line-5 text-center">
          <button nz-button nzType="default" class="button-blue" style="width: 78px;margin-right: 20px"
                  (click)="cancel()">取消
          </button>
          <button nz-button nzType="primary" style="width: 78px;"
                  [disabled]="!paperInfos.cateList || paperInfos.cateList.length === 0"
                  (click)="save()">保存
          </button>
        </div>
      </div>
    </div>
  </div>

  <!--预览评价表页面-->
  <div class="addPage" [hidden]="mainStatus !== 3">
    <div style="height: 30px;font-size: 16px;">
      <span>预览评价表</span>
      <span class="fl-r operaFont" (click)="back()">
        返回上一级<i class="fa fa-reply m-l-sm"></i>
      </span>
    </div>
    <div id="report">
      <div style="font-size: 20px;text-align: center;margin-bottom: 20px;font-weight: bold">{{previewObj?.name}}</div>
      <div style="height: 60px;line-height: 60px;font-size: 20px;margin-bottom: 20px;padding-left: 20px;background-color: #f8f8f8">
        {{previewTitle}}
      </div>
      <div style="padding: 0 25px;">
        <div style="margin-bottom: 30px;" *ngFor="let item of previewList;let i = index;">
          <div style="color: #333333;font-size: 20px;">
            <span *ngIf="item.type == '单选题'">{{i + 1}}、<span [innerHTML]="setText(item.content)" class="editimg"></span>（{{item.score}}分）</span>
            <span *ngIf="item.type == '简答题'">{{i + 1}}、<span [innerHTML]="setText(item.content)" class="editimg"></span></span>
          </div>
          <div style="color: #333333;font-size: 18px;margin-top: 10px;" *ngIf="item.type == '单选题'">
            <nz-radio-group nzDisabled style="font-size: 20px;" *ngIf="item.selectList && item.selectList.length > 0">
              <label nz-radio [nzValue]="opt.name" style="font-size: 20px;" *ngFor="let opt of item.selectList">{{opt.name}}</label>
            </nz-radio-group>
          </div>
          <div style="color: #333333;font-size: 18px;margin-top: 10px;" *ngIf="item.type == '简答题'">
            <textarea nz-input  placeholder="请输入" rows="3" disabled style="resize: none;width: 100%;font-size: 18px;"></textarea>
          </div>
        </div>
      </div>
    </div>
  </div>
</div>


<!--选择试题-->
<nz-modal [(nzVisible)]="isVisiblePaper"
          nzWidth="1160px"
          [nzTitle]="modalTitle"
          [nzContent]="modalContent"
          (nzOnCancel)="isVisiblePaper = false"
          [nzFooter]="footModel"
          nzMaskClosable="false"
>
  <ng-template #modalTitle>
    选择题目
  </ng-template>
  <ng-template #modalContent>
    <div>
      <div class="left-modal over-y">
        <nz-tree
          [nzData]="treeNodes"
          [nzExpandAll]="true"
          (nzClick)="subjectClick($event)"
        >
        </nz-tree>
      </div>
      <div class="right-modal">
        <div class="searchDiv m-b-sm" style="text-align: right">
          <label>
            <span>题目内容：</span>
            <input nz-input [(ngModel)]="serchSubjectInfos.subjectContent" placeholder="请输入"/>
          </label>
          <label style="margin-right: 0">
            <button nz-button style="margin-right:10px" nzType="primary" (click)="setSubjectPage()">查询</button>
            <button nz-button nzType="default" style="margin-right: 5px" (click)="resetSubjectSearch()">重置</button>
          </label>
        </div>
        <ng-template #totalSubTemplate let-total>总共 {{ pageSubjectInfo.totalRecords? pageSubjectInfo.totalRecords:0 }} 条
        </ng-template>
        <nz-table
          nzBordered
          [nzData]="pageSubjectList"
          [nzFrontPagination]="false"
          [nzShowPagination]="true"
          [nzPageIndex]="pageSubjectInfo.first"
          [nzTotal]="pageSubjectInfo.totalRecords"
          [nzShowTotal]="totalSubTemplate"
          [nzPageSize]="pageSubjectInfo.rows"
          [nzLoadingDelay]="1"
          [nzPageSizeOptions]="[10,20,30,50,100]"
          [nzShowQuickJumper]="true"
          [nzShowSizeChanger]="true"
          (nzPageIndexChange)="pageSubjectInfo.first = $event;getSubjectPage(pageSubjectInfo)"
          (nzPageSizeChange)="pageSubjectInfo.rows = $event;getSubjectPage(pageSubjectInfo)"
          (nzCurrentPageDataChange)="currentSbPageDataChange($event)"
          [nzScroll]="{ y: '300px' }"
        >
          <thead>
          <tr>
            <th nzWidth="50px" class="tableCheck"
                nzShowCheckbox
                [(nzChecked)]="isSubjectAllCheck"
                [nzIndeterminate]="isSubjectIndeterminate"
                (nzCheckedChange)="checkSbAll($event)"
            ></th>
            <th>题目内容</th>
            <th nzWidth="150px">分类</th>
          </tr>
          </thead>
          <tbody>
          <tr *ngFor="let data of pageSubjectList">
            <td
              nzShowCheckbox
              [(nzChecked)]="mapOfSubjectCheckedId[data.id]"
              (nzCheckedChange)="refreshSbStatus()"
            ></td>
            <td style="text-align: left">
              <div  class="spance" style="max-width: 200px; margin: auto"
                    title="{{strTagEleChange(data.content)}}">{{strTagEleChange(data.content)}}</div>
            </td>
            <td>{{data.classifyName}}</td>
          </tr>
          </tbody>
        </nz-table>
      </div>
    </div>
  </ng-template>
  <ng-template #footModel>
    <button nz-button nzType="default" (click)="isVisiblePaper = false">取消</button>
    <button nz-button nzType="primary" [disabled]="canSureSub" (click)="submitSubject()">确定</button>
  </ng-template>
</nz-modal>


































